package com.flextribe.math
{
	public class Combinatorics
	{
		public function Combinatorics()
		{
		}
		
		public static function factorial(n:Number):Number {
			if(n>1) return n*arguments.callee(n-1);
			return 1;
		}
		public static function toFactoradic(n:Number):Array {
			var factoradic:Array = [0];
			var j:Number = 1;
			while(j<=n) factoradic.unshift(Number(n/=j++)%j);
			return factoradic;
		}

	}
}